﻿namespace Unikado.PHPLibs.Tokenizer.Types
{

    /// <summary>
    /// The TypeFine is a part of a three-stage categorization of a PHP file token.
    /// Its the finest outlined/detailed type. (finest details)
    /// <code>
    /// TypeRough (Very rough outline)
    ///  + TypeNormal (A medium outline)
    ///     + TypeFine (This is the finest outline)
    /// </code>
    /// </summary>
    public enum TypeFine
    {

        #region TypeRough.None => TypeNormal.None

        /// <summary>
        /// The token contains no PHP code.
        /// </summary>
        None,

        #endregion

        #region TypeRough.PhpTag

        #region => TypeNormal.PhpTag

        /// <summary>
        /// A opening PHP Tag (All notations are supported)
        /// </summary>
        PhpTagOpen,
        /// <summary>
        /// A closing PHP tag.
        /// </summary>
        PhpTagClose,

        #endregion

        #endregion

        #region TypeRough.Whitespace

        #region  => TypeNormal.Space

        /// <summary>
        /// The token is defined by one or more spaces.
        /// </summary>
        Space,
        /// <summary>
        /// The token is defined by one or more tabulators.
        /// </summary>
        Tabulator,

        #endregion

        #region  => TypeNormal.NewLine

        /// <summary>
        /// The token is defined by one new line <c>\n</c>.
        /// </summary>
        NewLine,

        #endregion

        #endregion

        #region TypeRough.Comment

        #region => TypeNormal.Comment

        /// <summary>
        /// The token defines the complete hash comment, (<c># …</c>)
        /// </summary>
        HashComment,
        /// <summary>
        /// The token defines the complete slash comment. (<c>// …</c>)
        /// </summary>
        SlashComment,
        /// <summary>
        /// The token defines the complete multiline comment. <c>/* … */</c>
        /// </summary>
        MultilineComment,

        #endregion

        #region => TypeNormal.Docblock

        /// <summary>
        /// The token defines the complete DocBlockComment <c>/** … */</c>
        /// </summary>
        Docblock,

        #endregion

        #endregion

        #region TypeRough.KeywordSignature

        #region => TypeNormal.Visibility "public, protected, private"

        /// <summary>
        /// The <b>public</b> keyword
        /// </summary>
        Public, // public
        /// <summary>
        /// The <b>protected</b> keyword
        /// </summary>
        Protected, // protected
        /// <summary>
        /// The <b>private</b> keyword
        /// </summary>
        Private, // private

        #endregion

        #region => TypeNormal.SignatureIdentifier "class, const, define, interface, namespace, trait, function, use, var"

        /// <summary>
        /// The <b>class</b> keyword.
        /// </summary>
        Class, // class
        /// <summary>
        /// The <b>const</b> keyword.
        /// </summary>
        Const, // const
        /// <summary>
        /// The <b>define</b> keyword.
        /// </summary>
        Define, // define
        /// <summary>
        /// The <b>interface</b> keyword.
        /// </summary>
        Interface, // interface
        /// <summary>
        /// The <b>namespace</b> keyword.
        /// </summary>
        Namespace, // namespace
        /// <summary>
        /// The <b>trait</b> keyword.
        /// </summary>
        Trait, // trait
        /// <summary>
        /// The <b>function</b> keyword.
        /// </summary>
        Function, // function
        /// <summary>
        /// The <b>use</b> keyword.
        /// </summary>
        Use, // use
        /// <summary>
        /// The <b>var</b> keyword.
        /// </summary>
        Var, // var

        #endregion

        #region => TypeNormal.Inheritance "extends, implements"

        /// <summary>
        /// The <b>extends</b> Keyword.
        /// </summary>
        Extends, // extends
        /// <summary>
        /// The <b>implements</b> Keyword.
        /// </summary>
        Implements, // implements

        #endregion

        #region => TypeNormal.PrefixKeyword "abstract, final, static"

        /// <summary>
        /// The <b>abstract</b> Keyword.
        /// </summary>
        Abstract, // abstract
        /// <summary>
        /// The <b>final</b> Keyword.
        /// </summary>
        Final, // final
        /// <summary>
        /// The <b>static</b> Keyword.
        /// </summary>
        Static, // static

        #endregion

        #endregion

        #region TypeRough.Keyword

        #region => TypeNormal.ExceptionHandling "catch, finally, throw, try"

        /// <summary>
        /// The <b>catch</b> exception structure keyword
        /// </summary>
        Catch, // catch
        /// <summary>
        /// The <b>finally</b> exception structure keyword
        /// </summary>
        Finally, // finally
        /// <summary>
        /// The <b>throw</b> exception structure keyword
        /// </summary>
        Throw, // throw
        /// <summary>
        /// The <b>try</b> exception structure keyword
        /// </summary>
        Try, // try

        #endregion

        #region => TypeNormal.Output "echo, print"

        /// <summary>
        /// The <b>echo</b> keyword.
        /// </summary>
        Echo, // echo
        /// <summary>
        /// The <b>print</b> keyword.
        /// </summary>
        Print, // print

        #endregion

        #region => TypeNormal.Exit "die, exit"

        /// <summary>
        /// The <b>die</b> keyword.
        /// </summary>
        Die, // die
        /// <summary>
        /// The <b>exit</b> keyword.
        /// </summary>
        Exit, // exit

        #endregion

        #region => TypeNormal.DebugOutput "var_dump, print_r"

        /// <summary>
        /// The <b>var_dump</b> keyword.
        /// </summary>
        VarDump, // var_dump
        /// <summary>
        /// The <b>print_r</b> keyword.
        /// </summary>
        PrintR, // print_r

        #endregion

        #region => TypeNormal.ValueKeyword (true, false, null, array)

        /// <summary>
        /// The <b>true</b> Keyword
        /// </summary>
        True, // true
        /// <summary>
        /// The <b>false</b> Keyword
        /// </summary>
        False, // false
        /// <summary>
        /// The <b>array</b> Keyword
        /// </summary>
        Array, // null
        /// <summary>
        /// The <b>null</b> Keyword
        /// </summary>
        Null, // array

        #endregion

        #region => TypeNormal.BadCodeKeyword "eval, global"

        /// <summary>
        /// The <b>eval</b> keyword
        /// </summary>
        Eval, // eval
        /// <summary>
        /// The <b>global</b> keyword
        /// </summary>
        Global, // global

        #endregion

        #region => TypeNormal.ControlStructure "if, else, elseif, for, foreach, while, do, switch, declare, case, goto"

        /// <summary>
        /// The Keywords <b>for</b>, <b>foreach</b>, <b>do</b> and <b>while</b>
        /// </summary>
        Loop, // for, foreach, while, do
        /// <summary>
        /// The Keywords <b>if</b>, <b>elseif</b> and <b>else</b>
        /// </summary>
        IfElse, // if, else, elseif
        /// <summary>
        /// The keywords <b>switch</b> and <b>case</b>.
        /// </summary>
        Switch, // switch, case
        /// <summary>
        /// The <b>goto</b> keyword.
        /// </summary>
        Goto, // goto
        /// <summary>
        /// <b>declare</b>
        /// </summary>
        Declare, // declare

        #endregion

        #region => TypeNormal.ControlStructureInternal "as, break, continue, default, return, yield"

        /// <summary>
        /// The <b>return</b> exception structure keyword
        /// </summary>
        Return, // return
        /// <summary>
        /// The <b>as</b> keyword.
        /// </summary>
        As, // as
        /// <summary>
        /// The <b>break</b> keyword.
        /// </summary>
        Break, // break
        /// <summary>
        /// The <b>continue</b> keyword.
        /// </summary>
        Continue, // continue
        /// <summary>
        /// The <b>default</b> keyword.
        /// </summary>
        Default, // default
        /// <summary>
        /// The <b>yield</b> keyword.
        /// </summary>
        Yield, // yield

        #endregion

        #region => TypeNormal.ControlStructureAlt "endif, endfor, endforeach, endswitch, enddeclare"

        /// <summary>
        /// The <b>endif</b> Keyword.
        /// </summary>
        EndIf, // endif
        /// <summary>
        /// The <b>endfor</b> Keyword.
        /// </summary>
        EndFor, // endfor
        /// <summary>
        /// The <b>endforeach</b> Keyword.
        /// </summary>
        EndForeach, // endforeach
        /// <summary>
        /// The <b>endswitch</b> Keyword.
        /// </summary>
        EndSwitch, // endswitch
        /// <summary>
        /// The <b>enddeclare</b> Keyword.
        /// </summary>
        EndDeclare, // enddeclare

        #endregion

        #region  => TypeNormal.SpecialClasses "self, static, parent"

        /// <summary>
        /// The <b>self</b> Keyword.
        /// </summary>
        Self, // self
        /// <summary>
        /// The <b>static</b> Keyword.
        /// </summary>
        ClassStatic, // static
        /// <summary>
        /// The <b>parent</b> Keyword.
        /// </summary>
        Parent, // parent

        #endregion

        #region => TypeNormal.OtherKeyword "__halt_compiler, clone, callable, empty, instanceof, insteadof, isset, list, new, unset"

        /// <summary>
        /// The <b>clone</b> keyword.
        /// </summary>
        Clone, // clone
        /// <summary>
        /// The <b>instanceof</b> keyword.
        /// </summary>
        InstanceOf, // instanceof
        /// <summary>
        /// The <b>insteadof</b> keyword.
        /// </summary>
        InsteadOf, // insteadof
        /// <summary>
        /// The <b>new</b> keyword
        /// </summary>
        New, // new
        /// <summary>
        /// All other Keywords: <b>__halt_compiler</b>, <b>callable</b>, <b>empty</b>, <b>isset</b>, <b>list</b> and <b>unset</b>
        /// </summary>
        KeywordsOther, // __halt_compiler, callable, empty, isset, list, unset

        #endregion

        #endregion

        #region TypeRough.Operator

        #region  => TypeNormal.ComparisonOperator "!== === != == <> <= >= < >"

        /// <summary>
        /// The typesafe equal operastors <b>!==</b> and <b>===</b>
        /// </summary>
        EqualTypesafe, // !== ===
        /// <summary>
        /// The equal operastors <b>!=</b> and <b>==</b>
        /// </summary>
        Equal, // == !=
        /// <summary>
        /// The numerical equal operastors <b>&lt;&gt;</b>, <b>&lt;=</b>, <b>&gt;=</b>, <b>&lt;</b>, <b>&gt;</b>
        /// </summary>
        EqualNumerical, // <> <= >= < >

        #endregion

        #region  => TypeNormal.AssignmentOperator ">>= <<= ^= |= &= .= += -= *= /= %= = . =>"

        /// <summary>
        /// The bitwise Assignment operators: <b>&gt;&gt;=</b>, <b>&lt;&lt;=</b>, <b>^=</b>, <b>|=</b>, <b>&amp;=</b>
        /// </summary>
        AssignBitwise, // >>= <<= ^= |= &=
        /// <summary>
        /// The string concatenation operators: <b>.=</b> and <b>.</b>
        /// </summary>
        StringConcat, // .= .
        /// <summary>
        /// The aritmethic assignment operators: <b>+=</b>, <b>-=</b>, <b>/=</b>, <b>*=</b> and <b>%=</b>
        /// </summary>
        AssignAritmethic, // += -= /= *= &=
        /// <summary>
        /// The <b>=&gt;</b> operator for assign a array value to a array key e.g.: <c>array('key' => 'value')</c>
        /// </summary>
        AssignArray, // =>
        /// <summary>
        /// The plain asignment operator <b>=</b>
        /// </summary>
        Assign, // =

        #endregion

        #region  => TypeNormal.ScopeOperator "-> ::"

        /// <summary>
        /// The scope instance operator <b>-&gt;</b> for accessing object instance fields and methods.
        /// </summary>
        ScopeInstanceOperator, // ->
        /// <summary>
        /// The scope instance operator <b>::</b> for accessing static object fields and methods.
        /// </summary>
        ScopeStaticOperator, // ::

        #endregion

        #region  => TypeNormal.BitwiseOperator "<< >> & | ^ xor ~"

        /// <summary>
        /// A bitwise shift operator: <c>&lt;&lt;</c> and <c>&gt;&gt;</c>
        /// </summary>
        BitwiseShift,
        /// <summary>
        /// A other bitwise operator: <c>&amp;</c>, <c>|</c>, <c>^</c>, <c>xor</c>, <c>~</c>
        /// </summary>
        BitwiseOperator,

        #endregion

        #region  => TypeNormal.XCrementOperator "++ --"

        /// <summary>
        /// The increment operator <b>++</b>.
        /// </summary>
        Increment,
        /// <summary>
        /// The decrement operator <b>--</b>.
        /// </summary>
        Decrement,

        #endregion

        #region  => TypeNormal.LogicalOperator "and or && || ! ? :"

        /// <summary>
        /// The logical boolean operators <b>and</b>, <b>or</b>, <b>&amp;&amp;</b>, <b>||</b>, <b>!</b>
        /// </summary>
        LogicalBoolean, // and or && || !
        /// <summary>
        /// The logical questionmark operator <b>?</b> (only used for ternary conditions)
        /// </summary>
        Questionmark, // ?
        /// <summary>
        /// The logical colon operator <b>:</b>. Its used for ternary conditions.
        /// </summary>
        Colon, // :
        /// <summary>
        /// The logical colon operator <b>:</b>. Its used for <b>case …:</b> conditions (blocklevel increments)
        /// and for control structures with the alternative notation e.g.: <c>if (true):</c>
        /// </summary>
        ColonBlockOpener, // :

        #endregion

        #region  => TypeNormal.AritmethicOperator "+ - * / %"

        /// <summary>
        /// A aritmethic operator: <b>+</b> <b>-</b> <b>*</b> <b>/</b> <b>%</b>
        /// </summary>
        AritmethicOperator, // + - * / %

        #endregion

        #region  => TypeNormal.OtherOperator "; , @"

        /// <summary>
        /// The <b>;</b> semicolon operator.
        /// </summary>
        Semicolon, // ;
        /// <summary>
        /// The comma operator
        /// </summary>
        Comma, // ,
        /// <summary>
        /// The <b>@</b> PHP error control operator. (Its already a bad use!)
        /// </summary>
        ErrorControl, // @

        #endregion

        #endregion

        #region TypeRough.String

        #region  => TypeNormal.String   '…'  "…"

        /// <summary>
        /// A string inside single quotes. e.g.: <c>'foo bar'</c>
        /// </summary>
        StringSingle, // '…'
        /// <summary>
        /// A string inside double quotes. e.g.: <c>"foo bar"</c>
        /// </summary>
        StringDouble, // "…"

        #endregion

        #region  => TypeNormal.HereNowDoc

        /// <summary>
        /// A HEREDOC string, including opening and closing elements.
        /// </summary>
        HereDoc,
        /// <summary>
        /// A NOWDOC string, including opening and closing elements.
        /// </summary>
        NowDoc,

        #endregion

        #region  => TypeNormal.Command   `ls -a`

        /// <summary>
        /// A command string defined within backtick operators.
        /// </summary>
        Command, // `ls -a`

        #endregion

        #endregion

        #region TypeRough.Predefined

        #region  => TypeNormal.VariablePredefined

        /// <summary>
        /// A predefined PHP Superglobals variable: <b>$_COOKIE</b>, <b>$_ENV</b>, <b>$_FILES</b>, <b>$_GET</b>,
        /// <b>$_POST</b>, <b>$_REQUEST</b>, <b>$_SERVER</b>, <b>$_SESSION</b>. Only the Superglobal <b>$GLOBALS</b>
        /// IS NOT INCLUDED here.
        /// </summary>
        Superglobal, // $_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_REQUEST, $_SERVER, $_SESSION
        /// <summary>
        /// The <b>$GLOBALS</b> superglobal PHP variable.
        /// </summary>
        Globals, // $GLOBALS
        /// <summary>
        /// A predefined PHP variable (no Superglobals!)
        /// </summary>
        VariablePredefined,

        #endregion

        #region  => TypeNormal.ConstantPredefined

        /// <summary>
        /// All magic PHP constants: <b>__LINE__</b>, <b>__FILE__</b>, <b>__DIR__</b>, <b>__FUNCTION__</b>, <b>__CLASS__</b>,
        /// <b>__TRAIT__</b>, <b>__METHOD__</b>, <b>__NAMESPACE__</b>
        /// </summary>
        MagicConstant, // __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __TRAIT__, __METHOD__, __NAMESPACE__

        #endregion

        #region  => TypeNormal.OtherPredefined

        /// <summary>
        /// A predefined, known PHP core function na…
        /// </summary>
        PhpFunctionName,
        /// <summary>
        /// A predefined, known PHP core interface name.
        /// </summary>
        PhpInterfaceName,
        /// <summary>
        /// A predefined, known PHP core class name.
        /// </summary>
        PhpClassName,

        #endregion

        #endregion

        #region TypeRough.Bracket "{ [ ( ) ] }"

        #region  => TypeNormal.OpenBracket "{ [ ("

        /// <summary>
        /// The curly <c>{</c> block open bracket
        /// </summary>
        BlockOpenBracket, // {
        /// <summary>
        /// The round <c>(</c> condition open bracket
        /// </summary>
        ConditionOpenBracket, // (
        /// <summary>
        /// The square <c>[</c> open bracket.
        /// </summary>
        SquareOpenBracket, // [

        #endregion

        #region  => TypeNormal.CloseBracket  ") ] }"

        /// <summary>
        /// The curly <c>}</c> block close bracket
        /// </summary>
        BlockCloseBracket, // }
        /// <summary>
        /// The round <c>)</c> condition close bracket
        /// </summary>
        ConditionCloseBracket, // )
        /// <summary>
        /// The square <c>]</c> close bracket.
        /// </summary>
        SquareCloseBracket, // ]

        #endregion

        #endregion

        #region TypeRough.Include

        #region  => TypeNormal.Include

        /// <summary>
        /// The <b>include</b> function
        /// </summary>
        Include, // include
        /// <summary>
        /// The <b>include_once</b> function
        /// </summary>
        IncludeOnce, // include_once

        #endregion

        #region  => TypeNormal.Require

        /// <summary>
        /// The <b>require</b> function
        /// </summary>
        Require, // require
        /// <summary>
        /// The <b>require_once</b> function
        /// </summary>
        RequireOnce, // require_once

        #endregion

        #endregion

        #region TypeRough.Number

        #region  => TypeNormal.Float

        /// <summary>
        /// A normal floating point number definition.
        /// </summary>
        Float,
        /// <summary>
        /// A expontentiol floating point number definition
        /// </summary>
        FloatExp,

        #endregion

        #region  => TypeNormal.Integer

        /// <summary>
        /// A integer number in normal integer notation
        /// </summary>
        Integer,
        /// <summary>
        /// A integer number in octal notation (e.g.: <c>0750</c>)
        /// </summary>
        IntegerOct,
        /// <summary>
        /// A integer number in hexadecimal notation (e.g.: <c>0x2F</c>)
        /// </summary>
        IntegerHex,
        /// <summary>
        /// A integer number in binary notation (e.g.: <c>0b11000100</c>)
        /// </summary>
        IntegerBin,

        #endregion

        #endregion

        #region TypeRough.Other

        #region  => TypeNormal.Variable

        /// <summary>
        /// A normal PHP variable.
        /// </summary>
        Variable,
        /// <summary>
        /// A variable with complex name definition. e.g.: <c>${extended-variable-name}</c>
        /// </summary>
        VariableExtend,

        #endregion

        #region  => TypeNormal.Word

        /// <summary>
        /// Some other unspecified PHP words.
        /// </summary>
        Word,

        #endregion

        #region  => TypeNormal.Other

        /// <summary>
        /// All other stuff (This should never happen!)
        /// </summary>
        Other

        #endregion

        #endregion

    }

}